package com.shu.qq.component.tcp;

import io.netty.bootstrap.ServerBootstrap;
import io.netty.channel.Channel;
import io.netty.channel.ChannelFuture;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.socket.ServerSocketChannel;
import io.netty.channel.socket.nio.NioServerSocketChannel;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;

@Component
@Slf4j
public class TcpServer {
    @Value("${netty.tcp.port}")
    private Integer port;
    @Qualifier("tcpServerBootstrap") @Autowired
    ServerBootstrap bootstrap;

    public void start(){
        log.info("启动Tcp服务端  端口{}",port);
        Channel channel =  bootstrap.bind(port).channel();
    }
}
